{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "f0377876",
   "metadata": {},
   "source": [
    "#### 数字和变量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "9244de27",
   "metadata": {},
   "outputs": [],
   "source": [
    "num1 = 35\n",
    "num2 = 74\n",
    "\n",
    "total = num1 + num2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "cc455048",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total==>: 109\n"
     ]
    }
   ],
   "source": [
    "print(f\"Total==>: {total}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "33f20956",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "reduce==>: -25\n"
     ]
    }
   ],
   "source": [
    "num3 = 99\n",
    "\n",
    "reduce = num2 - num3\n",
    "\n",
    "print(f\"reduce==>: {div}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "2ef990dd",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mul==>: 2590\n"
     ]
    }
   ],
   "source": [
    "mul = num1 * num2\n",
    "print(f\"Mul==>: {mul}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "c163e0ef",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Div==>: 1.472972972972973\n"
     ]
    }
   ],
   "source": [
    "div = total / num2\n",
    "print(f\"Div==>: {div}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "855508e6",
   "metadata": {},
   "source": [
    "#####  改变变量的值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "5bd0212f",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " num1:35,\n",
      " num2:74,\n",
      " num3:99\n"
     ]
    }
   ],
   "source": [
    "print(f\" num1:{num1},\\n num2:{num2},\\n num3:{num3}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "1712b727",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " num1:30,\n",
      " num2:74,\n",
      " num3:99\n"
     ]
    }
   ],
   "source": [
    "num1 = 30\n",
    "print(f\" num1:{num1},\\n num2:{num2},\\n num3:{num3}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "078c9afb",
   "metadata": {},
   "source": [
    "#### 例题"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3f92f420",
   "metadata": {},
   "source": [
    "##### 一个四口之家的年龄之和是87岁，爸爸比妈妈大2岁，儿子比女儿大5岁，6年前，这个家庭成员年龄之和是65岁，这个家庭女儿现在的年龄是多少岁。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0643184d",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Step1:\n",
    "    \n",
    "a = 0\n",
    "b = 0\n",
    "c = 0\n",
    "d = 0\n",
    "\n",
    "# mama\n",
    "b = a - 2\n",
    "# daughter\n",
    "d = c - 5\n",
    "\n",
    "87 - 65 = 22\n",
    "4 * 6 = 24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "a872bc25",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "cannot assign to expression here. Maybe you meant '==' instead of '='? (2676457271.py, line 3)",
     "output_type": "error",
     "traceback": [
      "\u001b[0;36m  File \u001b[0;32m\"/tmp/ipykernel_24917/2676457271.py\"\u001b[0;36m, line \u001b[0;32m3\u001b[0m\n\u001b[0;31m    a + (a - 2) + c + (c - 5) = 87\u001b[0m\n\u001b[0m    ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m cannot assign to expression here. Maybe you meant '==' instead of '='?\n"
     ]
    }
   ],
   "source": [
    "# step2:\n",
    "    \n",
    "a + (a - 2) + c + (c - 5) = 87"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "d48acc9c",
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "import matplotlib\n",
    "import matplotlib.pyplot as plt"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
